mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	Merge pull request #141 from edpauto/failed-builds
Throw an error in case when command returns code other than 0
This commit is contained in:
		
						commit
						03680b8271
					
				@ -120,7 +120,7 @@ class Console
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $exceptionOccured = false;
 | 
				
			||||||
        // Run Command - Check if there is a Configuration Error
 | 
					        // Run Command - Check if there is a Configuration Error
 | 
				
			||||||
        if ($configError !== false) {
 | 
					        if ($configError !== false) {
 | 
				
			||||||
            self::output('<red>' . $configError . '</red>', 1, 2);
 | 
					            self::output('<red>' . $configError . '</red>', 1, 2);
 | 
				
			||||||
@ -136,7 +136,12 @@ class Console
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                $exitCode = $command->run();
 | 
					                $exitCode = $command->run();
 | 
				
			||||||
 | 
					                if (is_int($exitCode) && $exitCode !== 0) {
 | 
				
			||||||
 | 
					                    throw new Exception("Command execution failed with following exit code: $exitCode.", $exitCode);
 | 
				
			||||||
 | 
					                } elseif (is_bool($exitCode) && !$exitCode) {
 | 
				
			||||||
 | 
					                    $exitCode = 1;
 | 
				
			||||||
 | 
					                    throw new Exception("Command execution failed.", $exitCode);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            } catch (Exception $exception) {
 | 
					            } catch (Exception $exception) {
 | 
				
			||||||
                self::output('<red>' . $exception->getMessage() . '</red>', 1, 2);
 | 
					                self::output('<red>' . $exception->getMessage() . '</red>', 1, 2);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user