On Windows what is the difference between Git Bash vs Windows Power Shell vs Command prompt

Git bash is bash, which is IIRC also the default shell on MacOS. It is not the default shell on Windows, although several implementations exist (CygWin, MinGW, …). Git is bundled with a number of POSIX (UNIX/Linux/etc.) utilities in addition to bash; in order to avoid “collisions” with similarly named Windows commands, the most common … Read more

Git command line – know if in submodule?

(Update April 2017 for Git 2.13, Q2 2017) There is now an official command to determine if a repo is a submodule of a parent repo: cd /path/to/potential/submodule/repo git rev-parse –show-superproject-working-tree See commit bf0231c (08 Mar 2017) by Stefan Beller (stefanbeller). (Merged by Junio C Hamano — gitster — in commit 3edcc04, 17 Mar 2017) … Read more

How to return an error code without closing the Command Prompt window?

To get help for command prompt commands use their /? option. Exit /? shows: Quits the CMD.EXE program (command interpreter) or the current batch script. EXIT [/B] [exitCode] /B specifies to exit the current batch script instead of CMD.EXE. If executed from outside a batch script, it will quit CMD.EXE exitCode specifies a numeric number. … Read more

How to run commands via NodeJS child process?

Sending a newline \n will exectue the command. .end() will exit the shell. I modified the example to work with bash as I’m on osx. var terminal = require(‘child_process’).spawn(‘bash’); terminal.stdout.on(‘data’, function (data) { console.log(‘stdout: ‘ + data); }); terminal.on(‘exit’, function (code) { console.log(‘child process exited with code ‘ + code); }); setTimeout(function() { console.log(‘Sending stdin … Read more

How to answer to prompts automatically with python fabric?

Starting from version 1.9, Fabric includes a way of managing this properly. The section about Prompts in the Fabric documentation says: The prompts dictionary allows users to control interactive prompts. If a key in the dictionary is found in a command’s standard output stream, Fabric will automatically answer with the corresponding dictionary value. You should … Read more