You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally discussed with @bruce-one on #727, shifting the discussion to a dedicated issue.
While ShellJS aims to be cross-platform, it's often impossible to support posix behavior while also operating on Windows. For example, cp on unix supports FIFOs and special devices, neither of which really exists on Windows.
Supporting these edge cases within shelljs leads to a lot of platform-dependent code paths. Such code paths are risky, because they inherently can't be tested on Windows. This adds extra complexity, while also making our module behave inconsistently across platforms. Worse yet, if a logic bug sends us down such a code path on Windows, then we'll have unpredictable behavior.
The proposed solution is to treat special unix edge cases as error cases in shelljs. We'll then add explicit support for them in an optional plugin (perhaps named shelljs-plugin-unix). Some initial thoughts on the plugin:
Only supports unix. We can enforce this in our package.json with "os" : [ "darwin", "linux" ] or "os" : [ "!win32" ]. No process.platform checks needed 🎉
ShellJS must behave sensibly without the plugin. It's only intended to give more posix compliance for those who need it
First use case is to extend core shelljs commands (e.g. cp(), rm(), etc.) with support for fifo and block/character device
This might eventually support some of our unix-only commands, like chmod()
Support should be provided by overriding specific methods (e.g. handleSpecialFiles()). Similar concept as a subclass overriding a parent method.
The text was updated successfully, but these errors were encountered:
Originally discussed with @bruce-one on #727, shifting the discussion to a dedicated issue.
While ShellJS aims to be cross-platform, it's often impossible to support posix behavior while also operating on Windows. For example,
cp
on unix supports FIFOs and special devices, neither of which really exists on Windows.Supporting these edge cases within shelljs leads to a lot of platform-dependent code paths. Such code paths are risky, because they inherently can't be tested on Windows. This adds extra complexity, while also making our module behave inconsistently across platforms. Worse yet, if a logic bug sends us down such a code path on Windows, then we'll have unpredictable behavior.
The proposed solution is to treat special unix edge cases as error cases in shelljs. We'll then add explicit support for them in an optional plugin (perhaps named
shelljs-plugin-unix
). Some initial thoughts on the plugin:"os" : [ "darwin", "linux" ]
or"os" : [ "!win32" ]
. Noprocess.platform
checks needed 🎉cp()
,rm()
, etc.) with support for fifo and block/character devicechmod()
handleSpecialFiles()
). Similar concept as a subclass overriding a parent method.The text was updated successfully, but these errors were encountered: