Attach TProcess to a running process - freepascal

I want to read some info from a console process. I know how to do this by using TProcess to start the the process and read bytes through pipes, see here.
Is this possible if the console process is already running? How do I attach TProcess to the handle of the console process?

Related

Script to clean disk on GCP

I have an alert in Stackdriver for when disk usage is above 90%. Is it possible to create a script that cleans a specific folder whenever this alert is raised?
TL;DR: Not advisable to do so.
Is always a better idea to properly manage the data on your VM. You can use logrotate to get rid of old logs.
If you really really want execute a script when an alert is triggered, you can use a Webhook and tool like Hookdoo so when Stackdriver triggers an alert, it will call Hookdoo (installed) on your VM and can configure Hookdoo to delete some files on your VM.

Documentation on Application.launch() in JXA?

Where can I find documentation on Application.launch() in JXA?
Application('Safari').launch();
It seems Application.launch(), unlike Application.activate(), only starts the application process without actually open or activate an application window.
I searched the Internet and find no documentation on this function.
The launch command:
Launches an application, if it is not already running, but does not send it a run command.
If an application is already running, sending it a launch command has no effect. That allows you to open an application without performing its usual startup procedures, such as opening a new window or, in the case of a script application, running its script. For example, you can use the launch command when you don’t want an application to open and close visibly.
via https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW51
Note that while the above documentation is for AppleScript, it mostly applies to JXA, too.

IBM's Bluemix Toolchain process hangs on completion

I've built my container multiple times successfully, as noted by the image below. Each time it remains on 99% for > 20+ mins AFTER saying 'Finished: SUCCESS' in the logs. It never makes it past this. I cant kick off the deploy phase until the build registers completion. Is there a way to get past this hang?
I've got no notable errors in the console. The build is based on the registry.ng.bluemix.net/ibmnode:latest image, runs an apache2 server with some Node.js processes that run during the build phase. And lastly, it kicks off a bash script to run apache2 in the foreground.
I just checked my toolchain and wasn't able to reproduce this problem. Please try again, it might have been a transient issue with the toolchains.
If the problem persists, it might have to do with how you have your build script setup. If you are spawning processes and leaving them running, that could be stopping the build from finishing.

Tcl: How to run an executable on another machine

While working on machine xyz (could be linux or windows) - I need to start an executable program on another windows machine (just trigger would do).
How could that be done.
As per the comments provided, did the following purely on trial basis:
- Ran a custom listening tcl script on target machine (this was monitoring a shared file for writes) - also trying to use the win task scheduler to make it run each time user logs in
- On another machine that was to send command to the remote machine for exe execution, wrote a tcl proc to write to the shared file mentioned above
Thus whenever the file was written to, the script running on the target machine read the instructions and executed accordingly.
This is working for now, there are a few issues i am still facing but I think will get better eventually.

How to retrieve crash logs from Windows Phone 8 programmatically?

I have a WP8 App where I want to store the crash logs if and when generated.
Is there any way of fetching the crash dump file from Windows Phone 8 programmatically?
As far as I know, you can't retrieve the crash dumps that are automatically sent to the DevCenter. However, what you can do is subscribing to the global unhandled exception event handler, store the exception contents in the isolated storage, then do whatever you need with it (like sending it to a remote server). That's what many applications do, and it's even automated by some libraries (such as Telerik).
You can achieve that by using a logging system as MetroLog. You'll be able to collect these crash logs if you configure GlobalCrashHandler that will ensure that a FATAL log entry is written if an unhandled exception occurs.
You can install it using NuGet
Install-Package MetroLog
Here's an quick example:
using MetroLog;
using MetroLog.Targets;
LogManagerFactory.DefaultConfiguration.AddTarget(LogLevel.Trace, LogLevel.Fatal, new FileStreamingTarget());
GlobalCrashHandler.Configure();
ILogger log = LogManagerFactory.DefaultLogManager.GetLogger<MainPage>();
log.Trace("This is a trace message.");
You can find a tutorial explaining how to add it on your project at http://talkitbr.com/2015/06/11/adicionando-logs-em-universal-apps. Also there is an explanation regarding retrieving these logs.