We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cc25f30 commit 4905516Copy full SHA for 4905516
1 file changed
run-in-vagrant
@@ -22,12 +22,18 @@ if [ "$1" = '-h' ]; then
22
usage
23
fi
24
25
-echo "@TODO: WIP"
26
-exit 1
27
-
28
29
-if mount | grep -q '^/vagrant'; then
+VAGRANT_EXEC=$( which vagrant )
+VAGRANT_PRESENT=$?
+if [ $VAGRANT_PRESENT -eq 0 ] && ! mount | grep -q '^/vagrant'; then
+ echo '## Running command in vagrant.'
30
vagrant ssh -c "cd /vagrant; $@"
31
else
+ echo '## Running command natively.'
32
eval "$@"
33
34
+
35
+# Logic matrix:
36
+# vagrant installed + outside vm (no /vagrant mount point) = run in vagrant
37
+# vagrant installed + inside vm = run native
38
+# no vagrant + outside vm = run native
39
+# no vagrant + inside vm = run native
0 commit comments