Browse files

react-native-git-upgrade signal termination

When performing an upgrade using react-native-git-upgrade git can fail with a signal, however, only exit codes are accounted for.

Related issue: #12336

In my case, Git fails with a `SIGPIPE` signal - have not figured out why yet, but that's a separate issue. Before, since exit code was not zero, the console would default to the error case, but since no exit code was supplied, the error message was meaningless - `exited with code null`. Now, it errors out with `terminated with signal 'SIGPIPE'`, while still taking account of exit codes. Quoting [nodejs docs](

> The 'exit' event is emitted after the child process ends. If the process exited, code is the final exit code of the process, otherwise null. If the process terminated due to receipt of a signal, signal is the string name of the signal, otherwise null. One of the two will always be non-null.

I would be happy to write a test case for this but I haven't seen any react-native-git-upgrade ones?

[CLI] [ENHANCEMENT] [react-native/react-native-git-upgrade] - Git terminated by signal error message
Closes #16822

Differential Revision: D6387451

Pulled By: shergin

fbshipit-source-id: 25bf9dabdb5fda70d220bcd5f14c3c92bba8c3d4
  • Loading branch information...
mateusz- authored and facebook-github-bot committed Nov 21, 2017
1 parent 15179f1 commit b9a5862f670f52d48f1d3789c3f08ec139368da4
Showing with 10 additions and 4 deletions.
  1. +10 −4 react-native-git-upgrade/cliEntry.js
@@ -52,12 +52,18 @@ function exec(command, logOutput) {
child.on('exit', code => {
(code === 0)
? resolve(stdout)
: reject(new Error(`Command '${command}' exited with code ${code}:
child.on('exit', (code, signal) => {
if (code === 0) {
} else if (code) {
reject(new Error(`Command '${command}' exited with code ${code}:
stderr: ${stderr}
stdout: ${stdout}`));
} else {
reject(new Error(`Command '${command}' terminated with signal '${signal}':
stderr: ${stderr}
stdout: ${stdout}`));

0 comments on commit b9a5862

Please sign in to comment.