maid icon indicating copy to clipboard operation
maid copied to clipboard

use `execa` for better windows support

Open tunnckoCore opened this issue 6 years ago • 1 comments

Probably fixes #22. Plus better handling of python and actually the shorthands for those "languages".

Sorry that it's in one big commit, it was impossible in another way.

The thing is the following: a) When bash, we don't pass bash or sh or -c to the the exec call, so it can be handled by execa (i belive it switches between what's needed depending on platform?). b) If code block is python or py pass python -c to the command call. c) otherwise just call whatever is the codeblock.

The tests snapshots are intentionally updated, because was required too. We should trim the incoming code fence block content, because it may lead to errors in python for example.

tunnckoCore avatar Jun 06 '18 20:06 tunnckoCore

dooooh "Bad substitution" error on the CI :D i didn't have that problem, but yea.. I'm on ArchLinux. Probably should add again bash -c.

edit: but adding [type, '-c', ...] will defeat the purpose of this PR, duh. The whole point is to not add any flags or bash/zsh/sh so to work on windows, because the execa. doooooooh.

tunnckoCore avatar Jun 06 '18 20:06 tunnckoCore