The former CEOs of two major U.S. airlines slammed the government over the shutdown Friday, warning passenger safety could be at risk.

"This whole thing is both asinine and irresponsible. It just makes absolutely no sense," former American Airlines CEO Robert Crandall said on CNBC's "Squawk Alley," before President Donald Trump announced a deal with congressional leaders to end the shutdown and temporarily reopen the government.

Flights were disrupted at several East Coast airports after an increase in sick leave among air traffic controllers on Friday. Delays were seen at New York's LaGuardia Airport, Newark Liberty International Airport and Philadelphia International Airport. At one point earlier in the day, the FAA briefly halted flights into LaGuardia.

"There will be a call on the margin of safety," argued Crandall. "The reality is if we don't have full staffing then we can't do the full job. If you are going to squeeze in one more flight, if you want to say 'yes' one more time and maybe you make a mistake then you are eroding the margin of safety."

The partial government shutdown entered its 35th day on Friday. Just a day earlier, the Senate blocked two dueling bills that would have temporarily funded the government. The hope was that a short reprieve might help produce a deal to end the standoff over President Donald Trump's demand for border wall funding and the refusal by Democratic leaders to allocate any money for additional barriers along the U.S.-Mexico boundary lines.

On Friday afternoon, Trump said he expects Senate Majority Leader Mitch McConnell to bring the new measure to restart government operations to the Senate floor "immediately," which the president said he would sign.

Gordon Bethune, former CEO of Continental Airlines, agreed with Crandall's assessment, saying, "This is the craziest thing I've ever seen in my life." (Continental merged with United in 2010 to create United Continental Holdings in 2010.) "You have to restore the operations and you have to end this ludicrous shutdown," he added.

"I can't imagine why anybody would hold anybody except the president and the government responsible for this," Crandall said. "The government's willingness to shut down the economy, to have the profound adverse impact that this is going to have on the economy, just staggers the imagination."

The ongoing disruptions in airports around the country prompted air travel workers to issue a warning on Thursday. "In our risk averse industry, we cannot even calculate the level of risk currently at play, nor predict the point at which the entire system will break," said a joint statement from unions representing U.S. pilots, flight attendants and air traffic controllers. "It is unprecedented."

Asked whether the shutdown will affect the way airlines plan for the future, Crandall said Friday that it won't — because it should never happen again. "This is no way to run a government, a railroad or an airline," he said. "You can't do long-term planning in any area, certainly in aviation, unless you have the anticipation of stability."

Crandall also praised air traffic controllers, pointing out that the bulk of them are going to work despite not being paid. And the fact they are doing so "entitles them to accolades," he said.

— CNBC's Leslie Josephs contributed to this report.