Comments (3)
This means that the git command returned a non zero exit code (1). Interestingly there is no error output (this would normally be included in the exception.
Unfortunately standard out is not captured in the exception. You can suppress the exception with:
result = new ProcBuilder("git")
.withArgs("commit","-m").withArg(""+(char)34+"1st commit"+(char)34+"")
.withExpectedExitStatuses(0, 1)
.run();
If you then print the output like so:
System.out.println(result.getOutputString());
//now bail
if (result.getExitValue()!=0)
throw new RuntimeException("Failed to run git");
You might see what is going wrong.
Also, you don't need to add the quotation marks to the argument. they normally tell bash that your message is a single argument, i.e. they are stripped off when the arguments are passed to the process.
from jproc.
@fleipold Thank you, I found out the flaw in my code. Your suggestion was beneficial.
from jproc.
@Rupangkan I am glad you figured it out. Thank you for this bug report. I have improved the exception message, so it now includes standard out from the failed command (available in the latest release 2.5.1), here an example:
Exception in thread "main" org.buildobjects.process.ExternalProcessFailureException: External process `git` terminated with unexpected exit status 1 after 39ms:
$ git commit -m '1st commit'
STDOUT: On branch master
STDOUT:
STDOUT: Initial commit
STDOUT:
STDOUT: nothing to commit (create/copy files and use "git add" to track)
from jproc.
Related Issues (20)
- How o implement the pipe "|" HOT 6
- Starting a process with a command, and then interacting with it with subcommands? HOT 1
- Gradle support for the project? HOT 1
- run in windows will throw exception HOT 1
- How to get the command before executing HOT 2
- cd command is not working HOT 2
- Add Standard Out to Exception Message on Unexpected Exit Value HOT 1
- There is no way to keep an InputStream alive for the whole life of the Process HOT 6
- Process termination is not guaranted on Interruption HOT 2
- License: MIT or BSD? HOT 1
- How do I import this project? HOT 1
- Env vars handling HOT 6
- Bug in console output when using jproc to work with gpg HOT 2
- Migrate Build from Travis-ci.org to .com HOT 2
- Uncaught exception print in stderr when timeout HOT 1
- Is there a way to use jproc to set/reset password of linux user HOT 1
- Maven repository doesn't include the jar files in version 2.8.1 HOT 3
- Having issues with 'yt-dlp' capturing output HOT 1
- Created and published Modular version of this library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jproc.