Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/scripts/treemacs-count-mail.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from subprocess import Popen, PIPE
import sys
from os import environ

# Command line arguments are a list of maildirs.
# The output is a list of items in the form '((P1 A1) (P2 A2))' where P is the node path for a maildir
Expand Down Expand Up @@ -28,12 +29,12 @@ def main():
if mu_dir == "/":
continue

environ["LC_ALL"] = "C"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this approach environ["FOO"] = "BAR" was previously taken in one of the scripts before the most recent change - so there is some precedent for it.

unread = Popen(UNREAD_CMD.format(mu_dir.replace(" ", "\ ")),
shell=True,
stdout=PIPE,
bufsize=100,
encoding='utf-8',
env={"LC_ALL": "C"}
encoding='utf-8'
).communicate()[0][:-1]

if unread == "0":
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/treemacs-find-ignored-files.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from subprocess import Popen, PIPE
from os.path import exists
from os import environ
import sys

GIT_BIN = sys.argv[1]
Expand Down Expand Up @@ -37,7 +38,8 @@ def main():

for root in roots:
if exists(root + "/.git"):
proc = Popen(GIT_CMD, shell=True, stdout=PIPE, bufsize=100, cwd=root, env={"LC_ALL": "C"})
environ["LC_ALL"] = "C"
proc = Popen(GIT_CMD, shell=True, stdout=PIPE, bufsize=100, cwd=root)
procs.append((root, proc))

STDOUT.write(b"(")
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/treemacs-git-commit-diff.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from subprocess import Popen, PIPE
import sys
from os import environ

GIT_BIN = sys.argv[1]
STATUS_CMD = "{} status -sb".format(GIT_BIN)

def main():
proc = Popen(STATUS_CMD, shell=True, stdout=PIPE, bufsize=100, env={"LC_ALL": "C"})
environ["LC_ALL"] = "C"
proc = Popen(STATUS_CMD, shell=True, stdout=PIPE, bufsize=100)

if (proc.wait() != 0):
sys.exit(2)
Expand Down
6 changes: 4 additions & 2 deletions src/scripts/treemacs-git-status.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from subprocess import Popen, PIPE
from os import listdir
from os import listdir, environ
from os.path import isdir, islink
from posixpath import join
import sys
Expand Down Expand Up @@ -54,7 +54,9 @@ def find_recursive_entries(path, state):
def main():
global output, ht_size
# Don't lock Git when updating status.
proc = Popen(GIT_CMD, shell=True, stdout=PIPE, bufsize=100, env={"LC_ALL": "C", "GIT_OPTIONAL_LOCKS": "0"})
environ["LC_ALL"] = "C"
environ["GIT_OPTIONAL_LOCKS"] = "0"
proc = Popen(GIT_CMD, shell=True, stdout=PIPE, bufsize=100)
dirs_added = {}

for item in proc.stdout:
Expand Down
11 changes: 7 additions & 4 deletions src/scripts/treemacs-single-file-git-status.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from subprocess import run, Popen, PIPE, DEVNULL, check_output
import sys
import os
from os import environ

# There are 3+ command line arguments:
# 1) the file to update
Expand Down Expand Up @@ -90,14 +91,16 @@ def main():
print(elisp_alist)

def add_git_processes(status_listings, path):
ignored_proc = Popen(IS_IGNORED_CMD + path, shell=True, stdout=DEVNULL, stderr=DEVNULL, env={"LC_ALL": "C"})
tracked_proc = Popen(IS_TRACKED_CMD + path, shell=True, stdout=DEVNULL, stderr=DEVNULL, env={"LC_ALL": "C"})
changed_proc = Popen(IS_CHANGED_CMD + path, shell=True, stdout=PIPE, stderr=DEVNULL, env={"LC_ALL": "C"})
environ["LC_ALL"] = "C"
ignored_proc = Popen(IS_IGNORED_CMD + path, shell=True, stdout=DEVNULL, stderr=DEVNULL)
tracked_proc = Popen(IS_TRACKED_CMD + path, shell=True, stdout=DEVNULL, stderr=DEVNULL)
changed_proc = Popen(IS_CHANGED_CMD + path, shell=True, stdout=PIPE, stderr=DEVNULL)

status_listings.append((path, ignored_proc, tracked_proc, changed_proc))

def determine_file_git_state():
proc = Popen(FILE_STATE_CMD + FILE, shell=True, stdout=PIPE, stderr=DEVNULL, env={"LC_ALL": "C"})
environ["LC_ALL"] = "C"
proc = Popen(FILE_STATE_CMD + FILE, shell=True, stdout=PIPE, stderr=DEVNULL)
line = proc.stdout.readline()
if line:
state = line.lstrip().split(b" ")[0]
Expand Down