terminal

Why does terminal become unresponsive after I use certain git commands?

陌路散爱 提交于 2019-12-12 17:21:54
问题 Very often (every time really) after I use the command git log my terminal becomes unresponsive to further input, this is on OSX. Is there a command that I don't know about that will make the terminal active again instead of just quitting the terminal and starting over? 回答1: You are inside a program that displays the log without scrolling, most likely less , which can be exited by pressing the q key. 回答2: Just press q to quit from less . 来源: https://stackoverflow.com/questions/6005054/why

How to execute a terminal command in Xamarin.Mac and read-in its output

两盒软妹~` 提交于 2019-12-12 17:15:06
问题 We are writing a Xamarin.Mac application. We need to execute a command like "uptime" and read it's output into an application to parse. Could this be done? In Swift and Objective-C there is NTask, but I don't seem to be able to find any examples in C#. 回答1: Under Mono/Xamarin.Mac, you can the "standard" .Net/C# Process Class as the Process gets mapped to the underlaying OS (OS-X For Mono, MonoMac and Xamarin.Mac, and Mono for *nix). Process p = new Process(); p.StartInfo.UseShellExecute =

RVM ruby installation issue

廉价感情. 提交于 2019-12-12 16:54:47
问题 I've already got ruby and rails installed for some time and worked on some projects. Lately I've installed the Xcode 5 developer preview in order to get my apps ready for iOS 7. I'm just mentioning this in case the new Xcode messed it up. I first noticed the error when trying to rake asets:precompile in the rails project directory. It gives the following error: /Users/User/.rvm/bin/ruby: line 6: /Users/User/.rvm/bin/ruby: Argument list too long /Users/User/.rvm/bin/ruby: line 6: /Users/User/

How to set GCC_COLORS in gcc4.9 to emit colorizing diagnostics messages?

情到浓时终转凉″ 提交于 2019-12-12 16:14:49
问题 gcc4.9 supports the colorizing diagnostics for compiler warning/error messages. We can enable it for a particular program using the option " fdiagnostics-color ". Currently I am using gcc4.9.1 and I append this particular option in my makefile as follows: CC = /home/mantosh/gcc-4.9.1/bin/g++ -std=c++1y -Wall -pthread DFLAG = -g -gdwarf-2 -fdiagnostics-color=always OUTFILE = test $(OUTFILE): test.cpp $(CC) $(DFLAG) -o $(OUTFILE) test.cpp clean: rm -f *.o $(OUTFILE) If I compile a *.cpp file a

How can I print (☞゚ヮ゚)☞ with Ncurses?

冷暖自知 提交于 2019-12-12 15:03:33
问题 I would like to print (☞゚ヮ゚)☞ with the Ncurses library using C++ in Ubuntu. First of all, you can do this by simply having: std::cout << "(☞゚ヮ゚)☞" << std::endl; And it works just fine. However, when printing using Ncurses, I think that you need to use printw(char[]) . In which case, I try something like this: std::string str = "(☞゚ヮ゚)☞"; // String initscr(); // Start curses mode printw(str.c_str()); // Print getch(); // Wait for input endwin(); // Exit curses mode But it outputs: (�~X~^��~ �

Sublime Text 2 and Terminal

大兔子大兔子 提交于 2019-12-12 14:18:59
问题 So I'm trying to make it so that I can start Sublime Text 2 from the terminal through this command, given by the Sublime Text documentation: ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl But for some reason this is not working. I get this error from my terminal: ln: /Users/connorblack/bin/subl: No such file or directory Can anyone help me with this? Other details: I have SB2 in my Applications folder. I'm trying to do RoR development. 回答1: Your problem is

xdotool - Why sleep before running commands?

你。 提交于 2019-12-12 13:58:18
问题 I'm using xdotool to automate running commands, opening new tabs, etc. The thing is when doing it on the current window, I've to specifically sleep for some time or use xdotool keyup Return before doing anything or else xdotool won't press the enter key. kartik@kartikpc:~/junk/xdotool$ cat automate #!/bin/bash # Release the Return key # xdotool keyup Return # Or sleep 1 xdotool type --delay 1 --clearmodifiers "clear" xdotool key --clearmodifiers Return kartik@kartikpc:~/junk/xdotool$ source

Starting gnome-terminal with arguments

落花浮王杯 提交于 2019-12-12 13:34:31
问题 Using Python , I would like to start a process in a new terminal window, because so as to show the user what is happening and since there are more than one processes involved. I tried doing: >>> import subprocess >>> subprocess.Popen(['gnome-terminal']) <subprocess.Popen object at 0xb76a49ac> and this works as I want, a new window is opened. But how do I pass arguments to this? Like, when the terminal starts, I want it to say, run ls . But this: >>> subprocess.Popen(['gnome-terminal', 'ls'])

Want to resize terminal windows in python, working but not quite right

拟墨画扇 提交于 2019-12-12 13:34:25
问题 I'm attempted to resize the terminal window on launch of a python script to ensure the display will be static size. It's working but not quite what I expected. I've tried a few methods: import sys sys.stdout.write("\x1b[8;40;120t") and import subprocess subprocess.call(["echo","-e","\x1b[8;40;120t"]) and even just print "\x1b[8;40;80t" They all work and resize the real terminal. However, if my terminal is, let's say 25x80 to start, the script starts, it resizes, then exits. It will not

Filter out command that needs a terminal in Python subprocess module

血红的双手。 提交于 2019-12-12 12:50:54
问题 I am developing a robot that accepts commands from network (XMPP) and uses subprocess module in Python to execute them and sends back the output of commands. Essentially it is an SSH-like XMPP-based non-interactive shell. The robot only executes commands from authenticated trusted sources, so arbitrary shell commands are allowed ( shell=True ). However, when I accidentally send some command that needs a tty, the robot is stuck. For example: subprocess.check_output(['vim'], shell=False)