cloudmesh / cloudmesh-pi-burn

Burns many SD cards so we can build a Raspberry PI cluster
Other
18 stars 12 forks source link

subprocess error on cmd.exe and powershell #65

Closed jpfleischer closed 2 years ago

jpfleischer commented 2 years ago

there is an issue with burn on windows branch.

Shell.execute("rm", arguments=[
    '-f', filename])

line 1143 in cloudmesh-pi-burn/cloudmesh/burn/command/burn.py this line breaks on powershell and cmd.exe but not gitbash

ERROR: problem executing subprocess

Trace:
Traceback (most recent call last):
      File "C:\Users\Sledgehammer\cm\cloudmesh-common\cloudmesh\common\Shell.py", line 406, in execute
        result = subprocess.check_output(
      File "C:\Users\Sledgehammer\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 420, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "C:\Users\Sledgehammer\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 501, in run
        with Popen(*popenargs, **kwargs) as process:
      File "C:\Users\Sledgehammer\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "C:\Users\Sledgehammer\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    FileNotFoundError: [WinError 2] The system cannot find the file specified
laszewsk commented 2 years ago

This means that execute needs to be looked at or is it that rm does not exists and a command Shell.rm(file) should be used and implemented?

laszewsk commented 2 years ago

check if powershell command is:

Then we can look into SHell.rm(filename, force=True) where force would force delete it

laszewsk commented 2 years ago

we do have Shell.rm test on powershell, gitbash, and cmd.exe it should work

@classmethod

@NotImplementedInWindows

def rm(cls, location):
    """
    executes rm tree with the given arguments
    :param args:
    :return:
    """
    shutil.rmtree(path_expand(location))
jpfleischer commented 2 years ago

this has been solved thanks to Shell.rm https://github.com/cloudmesh/cloudmesh-pi-burn/commit/aba4e52d04eb140b109dbe04ba21f589b86a8844

jpfleischer commented 2 years ago

we have forfeited the possibility of running burn on powershell and cmd.exe and we are only focusing on git bash right now