From e2d44ce5cc3623818e1c9290d379909a7776c322 Mon Sep 17 00:00:00 2001 From: Winston Liu <50Wliu@users.noreply.github.com> Date: Thu, 2 May 2019 01:39:03 -0400 Subject: [PATCH] :fire: win-powershell.coffee --- src/main-process/win-powershell.coffee | 39 -------------------------- 1 file changed, 39 deletions(-) delete mode 100644 src/main-process/win-powershell.coffee diff --git a/src/main-process/win-powershell.coffee b/src/main-process/win-powershell.coffee deleted file mode 100644 index 29925a7c1..000000000 --- a/src/main-process/win-powershell.coffee +++ /dev/null @@ -1,39 +0,0 @@ -path = require 'path' -Spawner = require './spawner' - -if process.env.SystemRoot - system32Path = path.join(process.env.SystemRoot, 'System32') - powershellPath = path.join(system32Path, 'WindowsPowerShell', 'v1.0', 'powershell.exe') -else - powershellPath = 'powershell.exe' - -# Spawn powershell.exe and callback when it completes -spawnPowershell = (args, callback) -> - # Set encoding and execute the command, capture the output, and return it - # via .NET's console in order to have consistent UTF-8 encoding. - # See http://stackoverflow.com/questions/22349139/utf-8-output-from-powershell - # to address https://github.com/atom/atom/issues/5063 - args[0] = """ - [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 - $output=#{args[0]} - [Console]::WriteLine($output) - """ - args.unshift('-command') - args.unshift('RemoteSigned') - args.unshift('-ExecutionPolicy') - args.unshift('-noprofile') - Spawner.spawn(powershellPath, args, callback) - -# Get the user's PATH environment variable registry value. -# -# * `callback` The {Function} to call after registry operation is done. -# It will be invoked with the same arguments provided by {Spawner.spawn}. -# -# Returns the user's path {String}. -exports.getPath = (callback) -> - spawnPowershell ['[environment]::GetEnvironmentVariable(\'Path\',\'User\')'], (error, stdout) -> - if error? - return callback(error) - - pathOutput = stdout.replace(/^\s+|\s+$/g, '') - callback(null, pathOutput)