diff --git a/src/process.cr b/src/process.cr index 8b536ab1ec60..f3c850848320 100644 --- a/src/process.cr +++ b/src/process.cr @@ -17,7 +17,7 @@ class Process # not run any handlers registered with `at_exit`, use `::exit` for that. # # *status* is the exit status of the current process. - def self.exit(status = 0) : NoReturn + def self.exit(status : Int32 = 0) : NoReturn Crystal::System::Process.exit(status) end @@ -285,7 +285,7 @@ class Process fork_error.close unless fork_error.in?(error, STDERR) end - def finalize + def finalize : Nil @process_info.release end @@ -515,7 +515,7 @@ end # ``` # # See [`Command` literals](https://crystal-lang.org/reference/syntax_and_semantics/literals/command.html) in the language reference. -def `(command) : String +def `(command : String) : String process = Process.new(command, shell: true, input: Process::Redirect::Inherit, output: Process::Redirect::Pipe, error: Process::Redirect::Inherit) output = process.output.gets_to_end status = process.wait diff --git a/src/process/status.cr b/src/process/status.cr index 1e13556e0dfa..480da7df5664 100644 --- a/src/process/status.cr +++ b/src/process/status.cr @@ -95,7 +95,7 @@ enum Process::ExitReason # Returns `true` if the process exited abnormally. # # This includes all values except `Normal`. - def abnormal? + def abnormal? : Bool !normal? end @@ -107,7 +107,7 @@ enum Process::ExitReason # ``` # # `Status#description` provides more detail for a specific process status. - def description + def description : String case self in .normal? "Process exited normally" @@ -413,7 +413,7 @@ class Process::Status # ``` # # `ExitReason#description` provides the specific messages for non-signal exits. - def description + def description : String if exit_reason.signal? && (signal = exit_signal?) "Process received and didn't handle signal #{signal}" else