Commit Graph

12 Commits

Author SHA1 Message Date
brian m. carlson
9580353dca subprocess: add a function to shell quote a single string
We currently have a function to shell quote a list of strings, but in
some cases we may want to just quote a single string.  To avoid the
complexity of having to create a bunch of temporaries and then index out
the result, create a function that shell quotes just a single string.
2018-09-14 22:46:17 +00:00
brian m. carlson
912891d48f subprocess: add functions to format shell commands
There are a small number of places where we'll want to pass data to the
shell.  Add a function which formats a command name and arguments into a
command that invokes "sh -c" with the appropriate args.  Additionally
add a form that quotes its arguments, and use this in the SSH code,
which wants to pass data to the shell.
2018-09-14 22:31:39 +00:00
brian m. carlson
54fc03da43 subprocess: don't escape shell command due to slash
Add the slash to the list of characters which don't require quoting for
the shell.  No POSIX-compatible shell requires escaping the slash, and
ignoring it for the purposes of escaping lets us write cleaner,
nicer-to-read trace output.

Don't do the same with the backslash, which while being the equivalent
on Windows, is handled specially by POSIX shells.
2018-09-14 22:28:28 +00:00
brian m. carlson
899168eb50 tools: move ShellQuote to subprocess
In a future commit, we'll be adding some additional shell-related
handling which logically belongs to the subprocess package.  To avoid an
import loop, move the ShellQuote function and its required variable from
the tools package to the subprocess package.  Update the only caller of
this function.

This commit contains no functional change.
2018-09-14 21:50:09 +00:00
rick olson
7d003a17c6 git: run 'config' from dir based on *Configuration 2017-10-25 19:46:36 -06:00
rick olson
1fe966ac10 subprocess: add helper for consistent trace messages 2017-10-25 19:33:16 -06:00
Lars Schneider
f06601cab5 git: add git[NoLFS]Buffered() to run a Git processes with buffered output
Replicate `lfs/gitscanner_cmd` in `subprocess/buffered_cmd` using
subprocess/cmd. In subsequent commits we will migrate all functions
users of `lfs/gitscanner_cmd` to `subprocess/buffered_cmd` and
afterwards remove `lfs/gitscanner_cmd`.
2017-08-22 19:34:29 +02:00
Brett Randall
d06e97b37d Removed Go 1.6-specific API changes introduced in the previous commit. This commit can be reverted as soon as Go >= 1.6 is required.
This commit copies-down some utility methods introduced as part of the API change in Go 1.6.  These changes are convenient to use here, since they auto-truncate stderr error output.

Revert this commit when moving to Go 1.6.
2016-06-30 12:05:30 +10:00
Brett Randall
77734205b8 Stop SimpleExec swallowing errors. Fixed #1183.
ExitError conditions now return a plain error with message like:

    Error running git [config --system filter.lfs.clean git-lfs clean -- %f]: 'error: could not lock config file /etc/gitconfig: Permission denied' 'exit status 255'

Also:

* Made Set/Unset Config commands return errors when they occur.
* Made install attribute set fail properly with an error message e.g. if permission-denied.  Previously this failed silently and reported success.

***NOTE*** this commit contains Go 1.6-specific APIs.  The following commit will remove those, and that following commit can be reverted when Go >= 1.6 is required.
2016-06-30 12:05:30 +10:00
Taylor Blau
4593d0a641 vendor: vendor dependencies in vendor/ using Glide
- script/vendor received an update in order to work with Glide
- import paths have been rewritten to work with GO15VENDOREXPERIMENT
2016-05-23 12:10:35 -06:00
Steve Streeting
ab53c53e72 Document that our package structure is not guaranteed to be stable 2016-05-18 11:43:42 +01:00
Steve Streeting
d27a09e50f Refactor execCommand and simpleExec into separate package 2016-03-08 16:48:07 +00:00