Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #33213: remove the sage-cleaner program.
Browse files Browse the repository at this point in the history
  • Loading branch information
orlitzky committed Feb 17, 2022
1 parent ce5a76d commit 955fdba
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 261 deletions.
12 changes: 0 additions & 12 deletions src/bin/sage
Expand Up @@ -335,7 +335,6 @@ sage_setup() {
# exist, ipython complains.
mkdir -p -m 700 "$DOT_SAGE"
fi
sage-cleaner &>/dev/null &
}


Expand Down Expand Up @@ -516,10 +515,6 @@ usage_advanced() {
echo
echo " --sh [...] -- run a shell with Sage environment variables"
echo " as they are set in the runtime of Sage"
echo " --cleaner -- run the Sage cleaner. This cleans up after Sage,"
echo " removing temporary directories and spawned processes."
echo " (This gets run by Sage automatically, so it is usually"
echo " not necessary to run it separately.)"
#### 1.......................26..................................................78
#### |.....................--.|...................................................|
echo "File conversion:"
Expand Down Expand Up @@ -606,10 +601,6 @@ if [ "$1" = '-preparse' -o "$1" = "--preparse" ]; then
exec sage-preparse "$@"
fi

if [ "$1" = '-cleaner' -o "$1" = '--cleaner' ]; then
exec sage-cleaner
fi

#####################################################################
# Run Sage's versions of Python, pip, IPython, Jupyter.
#####################################################################
Expand Down Expand Up @@ -889,19 +880,16 @@ build_sage() {
}

if [[ "$1" =~ ^--notebook=.* || "$1" =~ ^-n=.* || "$1" =~ ^-notebook=.* ]] ; then
sage-cleaner &>/dev/null &
exec sage-notebook "$@"
fi

if [ "$1" = "-notebook" -o "$1" = '--notebook' -o "$1" = '-n' ]; then
sage-cleaner &>/dev/null &
exec sage-notebook "$@"
fi

if [ "$1" = "-bn" -o "$1" = "--build-and-notebook" ]; then
shift
build_sage
sage-cleaner &>/dev/null &
exec sage-notebook --notebook=default "$@"
fi

Expand Down
220 changes: 0 additions & 220 deletions src/bin/sage-cleaner

This file was deleted.

27 changes: 0 additions & 27 deletions src/sage/interfaces/cleaner.py
Expand Up @@ -35,30 +35,3 @@ def cleaner(pid, cmd=''):
o.write('%s %s\n'%(pid, cmd))
except IOError:
pass
else:
start_cleaner()


def start_cleaner():
"""
Start ``sage-cleaner`` in a new process group.
"""
if not os.fork():
os.setpgid(os.getpid(), os.getpid())

# Redirect stdin, stdout, stderr to /dev/null
with open(os.devnull, "r+") as f:
os.dup2(f.fileno(), 0)
os.dup2(f.fileno(), 1)
os.dup2(f.fileno(), 2)

# Close all other file descriptors
try:
maxopenfiles = os.sysconf("SC_OPEN_MAX")
if maxopenfiles <= 0:
raise ValueError
except ValueError:
maxopenfiles = 1024
os.closerange(3, maxopenfiles)

os.execlp("sage-cleaner", "sage-cleaner")
2 changes: 1 addition & 1 deletion src/sage/tests/cmdline.py
Expand Up @@ -181,7 +181,7 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False
0
sage: (out, err, ret) = test_executable(["sage", "--advanced"])
sage: out.find("run the Sage cleaner.") >= 0
sage: out.find("run a shell with Sage environment variables") >= 0
True
sage: err
''
Expand Down
1 change: 0 additions & 1 deletion src/setup.cfg.m4
Expand Up @@ -91,7 +91,6 @@ scripts =
bin/sage-valgrind
bin/sage-venv-config
bin/sage-version.sh
bin/sage-cleaner
# Only makes sense in sage-the-distribution. TODO: Move to another installation script.
bin/sage-list-packages
bin/sage-location
Expand Down

0 comments on commit 955fdba

Please sign in to comment.