Shell commands executed from Vim behave differently

2

I have mapped a key in Vim to run curl-based tests on my API with :map ,t :w\|:!quizzical tests.sh <CR>. The tests run as expected when I press the key; however, the tests which take longer to finish are said to have failed. These same tests repeatedly pass when in a normal shell. Is it possible that Vim is enforcing a stricter timeout-limit?

matt3141

Posted 2013-10-12T05:41:06.537

Reputation: 131

The shell invoked by Vim to run commands does not usually source its rc file (e.g., ~/.bashrc for bash), so it won't see any aliases, functions, or non-exported variables. I don't know why that would affect curl. – garyjohn – 2013-10-12T05:53:46.243

@garyjohn Interesting. Have you seen this in official documentation or did you notice by experience? If the former, could you point me in the right direction for this sort of information? – matt3141 – 2013-10-12T06:57:02.960

@matt3141, see :help 'shell' and $ man bash. – romainl – 2013-10-12T07:04:20.287

Answers

1

I was overlooking the fact that the server reloads upon save. Thus when I pressed the shortcut, the tests would begin while the change was being recognized by the server, and thus the longer tests would be interrupted by a restart of the server.

The issue was not with Vim or its shell, but rather, with the use of a key-mapping which saves then tests for an auto-restarting server. More specifically, probably, the issue was that the tests and server restart were independent tasks triggered by the same event.

matt3141

Posted 2013-10-12T05:41:06.537

Reputation: 131