Directory structure cleanup and organization overhaul
This commit is contained in:
parent
1a143982e1
commit
98fc49a978
119 changed files with 10483 additions and 4042 deletions
29
tests/integration/force_non_interactive.py
Normal file
29
tests/integration/force_non_interactive.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Force Python to be non-interactive"""
|
||||
import sys
|
||||
import os
|
||||
|
||||
print("Attempting to force non-interactive mode...")
|
||||
|
||||
# Remove ps1/ps2 if they exist
|
||||
if hasattr(sys, 'ps1'):
|
||||
delattr(sys, 'ps1')
|
||||
if hasattr(sys, 'ps2'):
|
||||
delattr(sys, 'ps2')
|
||||
|
||||
# Set environment variable
|
||||
os.environ['PYTHONSTARTUP'] = ''
|
||||
|
||||
# Try to set stdin to non-interactive
|
||||
try:
|
||||
import fcntl
|
||||
import termios
|
||||
# Make stdin non-interactive by removing ICANON flag
|
||||
attrs = termios.tcgetattr(0)
|
||||
attrs[3] = attrs[3] & ~termios.ICANON
|
||||
termios.tcsetattr(0, termios.TCSANOW, attrs)
|
||||
print("Modified terminal attributes")
|
||||
except:
|
||||
print("Could not modify terminal attributes")
|
||||
|
||||
print("Script complete")
|
||||
Loading…
Add table
Add a link
Reference in a new issue