-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprac.py
More file actions
executable file
·37 lines (28 loc) · 884 Bytes
/
Copy pathprac.py
File metadata and controls
executable file
·37 lines (28 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/env python
import os
import subprocess as sp
PATH = os.curdir
FZF = ['fzf', '--reverse']
LIST = '\n'.join(os.listdir(PATH)).encode()
process = sp.Popen(FZF, stdin=sp.PIPE)
process.communicate(input=LIST)
#!/usr/bin/env python
#
#import os
#import subprocess as sp
#
#PATH = os.curdir
#
## The command should be a list of strings where the first string is the command and the rest are arguments
#FZF = ['fzf']
#
## os.pipe() is used to create a pipe between two processes. Here, we want to pass the output of os.listdir() to FZF.
## This can be achieved by using subprocess.Popen().
#
## First, we convert the list of directory names to a byte stream
#dir_names = '\n'.join(os.listdir(PATH)).encode()
#
## Then, we create a subprocess with stdin from PIPE and pass the byte stream to it
#process = sp.Popen(FZF, stdin=sp.PIPE)
#process.communicate(input=dir_names)
#