pickFolder behavior changed and terminates function call without message
- Dominant language
- Perl
- Stars
- 3.9k
- Forks
- 213
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Starting with build 544 the behavior of pickFolder has changed. I believe it was not intended, but please correct me if I am wrong.
The behavior has changed on the command line use and when calling in a subprocess.
On the command line the expected and up to build 543 experienced behavior was that after selecting a folder with pickFolder the current directory has been changed to the selected directory. Since build 544 the prompt show the directory where pickFolder was started. Once you hit the directory changes to the selected directory.
In both builds the selected directory is added to the bookmarks.
This behavior does not allow a Python script to read the selected directory. For this I modified the script of [#387 ](https://github.com/holzschu/a-shell/issues/387). Modified code at the end.
I try to read the current directory and return it to the caller. Due to the changed behavior it is always the calling directory.
Another behavior occurs if call from a Python script. Not always but regularly.
Sometimes the function terminates in the subprocess call and does not execute the remaining code, but code in the caller of the function.
Here comes the script code:
```Python
import subprocess
import os
from time import sleep
def ashell_environment():
"""
Rely on pickFolder in ashell to create the environment
"""
src = ""
dst = ""
print("Please provide your Source path: ")
cmd = "pickFolder"
sleep(2) # The user needs to read the message !
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
(output, err) = p.communicate()
#This makes the wait possible
p_status = p.wait()
# Now, the os.getcwd() change for the pickedFolder
src = os.getcwd()
print(f"Source: {src}")
# return to default environment
cmd = "cd"
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
(output, err) = p.communicate()
#This makes the wait possible
p_status = p.wait()
print("Please provide the dest path: ")
cmd = "pickFolder"
sleep(5) # The user needs to read the message !
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
(output, err) = p.communicate()
#This makes the wait possible
p_status = p.wait()
dst = os.getcwd()
print(f"Destination: {dst}")
# return to default environment
cmd = "cd"
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
(output, err) = p.communicate()
#This makes the wait possible
p_status = p.wait()
print("Returning path for src and dst")
return src, dst
src, dst = ashell_environment()
print(f"Source: {src}\nDestination: {dst}")
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.